<template>
	<view class="pay-result">
		<image class="image" src="/static/images/success.png" mode="widthFix"></image>
		<view class="text" v-if="type == 'success'">支付成功！</view>
		<view class="text" v-if="type == 'fail'">支付失败！</view>
		
		<view class="list-bg">
			<view class="peform-title">{{ title }}</view>
			<!-- <view class="qr-items" >
				<view class="it-left">
					<view class="qcode">券码：11313412341234341</view>
					<view class="loc">座位号：A区1排1座</view>
				</view>
				<view class="it-right">
					<view class="qr-bg">
						<zb-code :size="60" :ref="'qrCodeycgp'+index" cid="qr-code-ycq" :val="sub.sn_number"></zb-code>
					</view>
				</view>
			</view> -->
			<view class="qr-items" v-for="(sub, index) in info.child" :key="index">
				<view class="it-left">
					<view class="qcode">券码：{{ sub.sn_number }}</view>
					<view class="loc">座位号：{{sub.region_number}}区{{ sub.row_number }}排{{ sub.column_number }}座</view>
				</view>
				<view class="it-right">
					<view class="qr-bg">
						<zb-code :size="60" :ref="'qrCodeycgp'+index" cid="qr-code-ycq" :val="sub.sn_number"></zb-code>
					</view>
				</view>
			</view>
		</view>
		

		<!-- <view class="qrcode"></view> -->

		<view style="height: 50px;"></view>
		<view>可在我演出订单中查看</view>
		<view class="foot">
			<view class="text1" @click="goHome">返回首页</view>
			<view class="text2" @click="goOrder">演出订单</view>
		</view>
	</view>

</template>

<script>
	import zbCode from '@/components/zb-code/zb-code.vue'
	import {
		performGetOrderDetail,
	} from "@/api/2_activity";
	export default {
		components: {
			zbCode
		},
		data() {
			return {
				type: 'success',
				title: '',
				order_sn: '',
				id: '',
				info: {}
			};
		},
		onLoad(options) {
			this.type = options.type
			this.title = options.title
			this.order_sn = options.order_sn
			this.id = options.id
			this.init()
		},
		methods: {
			previewImage(url) {
				console.log('====', url);
				//uniapp预览轮播图
				uni.previewImage({
					current: 0, //预览图片的下标
					urls: [url] //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			init() {
				performGetOrderDetail(this.order_sn, this.id).then(res => {
					let {
						data
					} = res
					this.info = data
					
					this.$nextTick(()=>{
						this.info.child.map((item,index)=>{
							console.log('====>',index);
							this.$refs['qrCodeycgp'+index][0]._makeCode()
						})
						
					})
				})
			},
			goHome() {
				uni.switchTab({
					url: '/pages/index/2_index'
				})
			},
			goOrder() {
				uni.navigateTo({
					url: '/pages/2_development/user/platform_show_order'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	.pay-result {
		text-align: center;

		.image {
			display: block;
			margin: 30rpx auto 30rpx;
			width: 200rpx;
			height: 200rpx;
			// background: #eee;
		}

		.text {
			text-align: center;
		}

		.qrcode {
			display: block;
			margin: 0 auto;
			width: 400rpx;
			height: 400rpx;
			background-color: #eee;
		}
		.redbg{
			width:120rpx;
			height:120rpx;
			background-color: #FF3700;
		}
	}

	.foot {
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 30rpx;

		.text1 {
			font-size: 30rpx;
			color: #e93323;
			width: 240rpx;
			height: 70rpx;
			background-color: #ffff;
			border: 1px solid #e93323;
			border-radius: 50rpx;
			text-align: center;
			line-height: 70rpx;
		}

		.text2 {
			font-size: 30rpx;
			color: #fff;
			width: 240rpx;
			height: 70rpx;
			background-color: #e93323;
			border-radius: 50rpx;
			text-align: center;
			line-height: 70rpx;
			margin-left: 30rpx;
		}
	}

	.descs {
		display: flex;
		width: 500rpx;
		margin: 20rpx auto 0;
		
		.tips {
			width: 132rpx;
			text-align: right;
			margin-right: 10px;
		}

		.desc {
			margin-bottom: 10rpx;
			text-align: left;
			display: flex;
			    align-items: center;
			.btn-hx {
				margin-left: 10rpx;
				color: #007AFF;
			}
		}
	}
	
	.list-bg{
		display: flex;
		flex-direction: column;
		
		.peform-title{
			font-size: 28rpx;
			font-weight: bold;
			height: 100rpx;
			border-top: 10rpx solid #F1F1F1;
			margin-top: 30rpx;
			padding-top: 30rpx;
		}
		.qr-items{
			margin-left: 50rpx;
			margin-right: 50rpx;
			flex: 1;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			.it-left{
				display: flex;
				flex-direction: column;
				justify-content: center; 
				text-align: left; 
				flex: 1;
				
				.qcode{
					font-size: 22rpx;
				}
				.loc{
					font-size: 22rpx;
					margin-top: 10rpx;
				}
			}
			
			.it-right{
				width:100rpx;
				height:100rpx;
				display: flex;
				flex-direction: row;
				justify-content: center;
				align-items: center;
				
				.qr-bg{
					width:60rpx;
					height:60rpx;
				}
			}
		}
	}
</style>
